package com.xuebusi.orm;

import com.xuebusi.orm.mybatis.entity.TUser;
import com.xuebusi.orm.mybatis.mapper.TUserMapper;
import com.xuebusi.orm.mybatis.session.SqlSession;
import com.xuebusi.orm.mybatis.session.SqlSessionFactory;

import java.util.List;

/**
 * 测试类
 */
public class App {
    public static void main(String[] args) {
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactory();
        SqlSession session = sqlSessionFactory.openSqlSession();
        System.out.println(session);

        TUserMapper userMapper = session.getMapper(TUserMapper.class);
        TUser user = userMapper.selectByPrimaryKey(1);
        System.out.println(user);

        List<TUser> selectAll = userMapper.selectAll();
        for (TUser u : selectAll) {
            System.out.println(u);
        }
    }
}
